package com.lik.javadeep;

import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

public class CopyOnWriteListTest {
    public static void main(String[] args) {
        CopyOnWriteArrayList<Object> objects = new CopyOnWriteArrayList<>();
        objects.add(1);
        objects.add(2);
        objects.add(3);

        Iterator<Object> iterator = objects.iterator();
        iterator.next();
        // 修改
        objects.add(4);
        iterator.next();
    }
}
